Assignment: Rational
Due: 9/6/2005
Points: 25
Files:
Rational.h
Rational.cpp
Class Name:
Rational
Goal:
Create a data type to represent a rational number.
Numerator and denominator should be private integers.
Constructors:
- One with
no parameters, default numerator to 0 and denominator to 1
- One
with 1 parameter, numerator should take the value of the parameter and
denominator should default to 1
- One
with 2 parameters, numerator and denominator should get their values from
the parameters
Public Functions:
- set –
one int or two
- add - one
int or two
- subtract
– one int or two
- multiply
– one int or two
- divide
– one int or two
- display n / d
Private Functions:
- reduce
- commonDenominator
takes one or two ints